package com.ThreadStudy.StudyDemo;

public class TestThread2 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println("run方法:---->"+i);

        }
    }


    public static void main(String[] args) {

        // 创建一个Runnable接口的实现类对象,
        TestThread2 testThread2 = new TestThread2();
        // 创建线程对象,通过线程对象来开启我们的线程,代理,把我们的对象丢进去
        Thread thread = new Thread(testThread2);
        thread.start();

//        new Thread(testThread2).start();

        for (int i = 0; i < 20; i++) {
            System.out.println("main方法:--->"+i);
        }







    }
}
